using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using static WaterCylinder.Tool;

//玩家操作模式
public enum PlayerOperaModel{
    Keyboard = 0,//键盘模式
    Mouse = 1,//鼠标模式
    Custom = 2,//自定义模式
}
public class PlayerConfig : IConfig
{   
    public PlayerOperaModel model;
    public PlayerOperaModel moveModel;
    public string shot = "";
    public string use = "";
    public string skill0 = "";
    public string skill1 = "";
    public string intercat = "";
    public void Load(){
        LoadOperaModel();
        GameManager.instance.playerConfig = this;
    }
    public void LoadOperaModel(){
        model = Int2Enum<PlayerOperaModel>(Config.GetSetting<int>("OperaModel", "Player.OperaModel"));
        LoadOperaModel(model.ToString());
    }
    public void LoadOperaModel(string model){
        moveModel = Int2Enum<PlayerOperaModel>(Config.GetSetting<int>(model+".Move.Model", "Player.OperaModel"));
        if(moveModel == PlayerOperaModel.Keyboard){
            WaterCylinder.Input.KeyLeft = Config.GetSetting<string>(model+".Move.Left", "Player.OperaModel");
            WaterCylinder.Input.KeyRight = Config.GetSetting<string>(model+".Move.Right", "Player.OperaModel");
            WaterCylinder.Input.KeyUp = Config.GetSetting<string>(model+".Move.Up", "Player.OperaModel");
            WaterCylinder.Input.KeyDown = Config.GetSetting<string>(model+".Move.Down", "Player.OperaModel");
        }
        shot = Config.GetSetting<string>(model+".Shot", "Player.OperaModel");
        use = Config.GetSetting<string>(model+".Use", "Player.OperaModel");
        skill0 = Config.GetSetting<string>(model+".Skill.0", "Player.OperaModel");
        skill1 = Config.GetSetting<string>(model+".Skill.1", "Player.OperaModel");
        intercat = Config.GetSetting<string>(model+".Interact", "Player.OperaModel");
    }
}
